public class d02 {
    public static void main(String[] args) {

    }
}
import java.io.File;
import java.util.HashSet;
import java.util.Set;

public class HTMLFileFinder {

        public Set<File> findHTMLFiles(String outPath) {
                    Set<File> htmlFiles = new HashSet<>();
                            File directory = new File(outPath);
                                    if (!directory.exists() || !directory.isDirectory()) {
                                                    System.err.println("指定的路径不存在或不是一个目录");
                                                                return htmlFiles;
                                    }
                                            findHTMLFilesRecursive(directory, htmlFiles);
                                                    return htmlFiles;
        }

            private void findHTMLFilesRecursive(File directory, Set<File> htmlFiles) {
                        File[] files = directory.listFiles();
                                if (files != null) {
                                                for (File file : files) {
                                                                    if (file.isDirectory()) {
                                                                                            findHTMLFilesRecursive(file, htmlFiles);
                                                                    } else if (file.isFile() && file.getName().endsWith(".html")) {
                                                                                            htmlFiles.add(file);
                                                                    }
                                                }
                                }
            }

                public static void main(String[] args) {
                            HTMLFileFinder finder = new HTMLFileFinder();
                                    Set<File> htmlFiles = finder.findHTMLFiles("your/outpath/directory");
                                            System.out.println("找到的HTML文件：");
                                                    for (File file : htmlFiles) {
                                                                    System.out.println(file.getAbsolutePath());
                                                    }
                }
}9
                                                    }
                }
                                                                    }
                                                                    }
                                                }
                                }
            }
                                    }
        }
}
import java.io.File;

public class FileDeleter {

        public void deleteFiles(String outPath) {
                    File directory = new File(outPath);
                            if (!directory.exists() || !directory.isDirectory()) {
                                            System.err.println("指定的路径不存在或不是一个目录");
                                                        return;
                            }
                                    deleteFilesRecursive(directory);
        }

            private void deleteFilesRecursive(File directory) {
                        File[] files = directory.listFiles();
                                if (files != null) {
                                                for (File file : files) {
                                                                    if (file.isDirectory()) {
                                                                                            deleteFilesRecursive(file);
                                                                    } else {
                                                                                            if (file.delete()) {
                                                                                                                        System.out.println("已删除文件: " + file.getAbsolutePath());
                                                                                            } else {
                                                                                                                        System.err.println("无法删除文件: " + file.getAbsolutePath());
                                                                                            }
                                                                    }
                                                }
                                }
                                        // 删除空文件夹
                                                if (directory.listFiles().length == 0) {
                                                                if (directory.delete()) {
                                                                                    System.out.println("已删除空文件夹: " + directory.getAbsolutePath());
                                                                } else {
                                                                                    System.err.println("无法删除空文件夹: " + directory.getAbsolutePath());
                                                                }
                                                }
            }

                public static void main(String[] args) {
                            FileDeleter deleter = new FileDeleter();
                                    deleter.deleteFiles("your/outpath/directory");
                }
}
                }
                                                                }
                                                                }
                                                }
                                                                                            }
                                                                                            }
                                                                    }
                                                                    }
                                                }
                                }
            }
                            }
        }
}




